import service from "@/service";

//【查询条件】通过用户id查询项目列表
export function getProjectList(data) {
  let { userId } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-project/getProjectInfoByUserId?userId=${userId}`,
    method: "POST",
  });
}

//【查询条件】通过用户id+项目编码查询标段列表 首页定制化接口 试验检测系统显示检测单位 其他系统显示标段
export function getBlockList(data) {
  let { userId, tenantCode } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-org/getInfoByUserIdAndTenantCodeHomePage?userId=${userId}&tenantCode=${tenantCode}`,
    method: "POST",
    data: {
      systemCode: "",
    },
  });
}

export function getBlockList2(data) {
  let { userId, tenantCode } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-org/getInfoByUserIdAndTenantCodeEqu?userId=${userId}&tenantCode=${tenantCode}`,
    method: "POST",
    data: {
      systemCode: "",
    },
  });
}

// 【查询条件】通过项目编码查询系统列表
export function getSystemList(parameter) {
  let { tenantCode } = parameter;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-system/getSystemListByProCode?tenantCode=${tenantCode}`,
    method: "GET",
    params: {},
  });
}

// 【查询条件】根据系统查询设备类型列表
export function getEquTypeList(parameter) {
  let { systemCode } = parameter;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/getEquTypeBySystemCode?systemCode=${systemCode}`,
    method: "GET",
    params: {},
  });
}

//【table】查询设备列表
export function getEqumentList(data) {
  let {
    page,
    pageSize,
    tenantCode = "",
    orgCode = "",
    systemCode = "",
    equTypeValue = "",
    equName = "",
    entityEquNum = "",
    roleId = "",
  } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/list?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data: {
      tenantCode,
      orgCode,
      systemCode,
      equTypeValue,
      equName,
      entityEquNum,
      roleId,
    },
  });
}

// 删除
export function deleteEqument(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/delete?id=${id}`,
    method: "POST",
  });
}

// 通过项目编码、标段编码、系统编码、设备类型、字段类型查询设备字段列表
export function getByCondition(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ-field-config/getByCondition`,
    method: "POST",
    data,
  });
}

// 添加设备
export function addEquiment(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/add`,
    method: "POST",
    data,
  });
}

// 查看
export function queryEquimentDetails(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/updateDetail?id=${id}`,
    method: "POST",
  });
}

// 修改设备
export function editorEquiment(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/update`,
    method: "POST",
    data,
  });
}

//查询特殊处理标题
export function getSpecialTabs(data) {
  let { dicValue, dictKey = "specialDealEqu" } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-dict-data/selectDictDescByKeyAndValue?dicValue=${dicValue}&dictKey=${dictKey}`,
    method: "POST",
  });
}

//【特殊处理】查询特殊字段列表
export function getSpecialFileds(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/equFieldList`,
    method: "POST",
    data,
  });
}

//【特殊处理】字段配置-编辑
export function editorSpecialFileds(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/equFieldEdit`,
    method: "POST",
    data,
  });
}

// 【特殊处理--规则配置】特殊字段查询
export function specialRuleConfig(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/specialRuleConfig?id=${id}`,
    method: "POST",
  });
}

// 【特殊处理--规则配置】特殊字段保存
export function saveSpecialRule(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/saveSpecialRule`,
    method: "POST",
    data,
  });
}

//【通知配置】- 查询列表
export function querynotificationList(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/specialNoticeConfig?id=${id}`,
    method: "POST",
  });
}

//【通知配置】- 查询群组列表
export function queryGroup(data) {
  let { equNum } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-group/queryGroupByEquNum?equNum=${equNum}`,
    method: "POST",
  });
}

//【通知配置】- 管理群组-保存
export function saveSpecialNotice(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/saveSpecialNotice`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-查询面层列表
export function queryRatio(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/queryRatio`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-查询工区列表
export function queryAreaList(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/queryAreaList`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-预警列表
export function warncfgDetail(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/warncfgDetail`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-高支模-预警列表
export function dzmWarncfgDetail(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/highFormworkWarncfgDetail`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-环境监测-预警列表
export function envWarncfgDetail(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/configEquWarncfgDetail`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-水泥搅拌桩-预警列表
export function snMixWarncfgDetail(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/subgradeWarncfgDetail`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-水泥搅拌桩-保存
export function snMixWarncfgEdit(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/subgradeWarncfgEdit`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-环境监测-保存
export function envWarncfgEdit(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/configEquWarncfgEdit`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-高支模-保存
export function gzmWarncfgEdit(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/highFormworkWarncfgEdit`,
    method: "POST",
    data,
  });
}

//【预警配置】- 生产预警-预警列表-保存
export function warncfgEdit(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/warncfgEdit`,
    method: "POST",
    data,
  });
}

export function getTestNameList(data = {}) {
  let { userId, tenantCode, orgCode } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-org/getTestUnitByUserIdAndTenantCodeAndOrgCode?userId=${userId}&tenantCode=${tenantCode}&orgCode=${orgCode}`,
    method: "POST",
    data,
  });
}

//【特殊处理】- 试验类型列表
export function queryTrialType(data = {}) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/queryBeamTrialType`,
    method: "POST",
    data,
  });
}

//【特殊处理】- 试验类型保存
export function saveEquTrialType(data = {}) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-equ/saveEquBeamTrialType`,
    method: "POST",
    data,
  });
}
